<%@ page language="java" %>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.utils.StringUtils"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<html:html >
<HEAD>
<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>
<logic:present name="wipFlush" scope="session">
<BODY>
<TABLE BORDER="0" align="center" width="100%">
    <TR>
        <TD WIDTH="90%" VALIGN="CENTER" ALIGN="CENTER" CLASS="NArialW" >Wip Flush - <%=request.getParameter("heading")%> Report By Product <%=request.getParameter ( "holdHeading" )%></TD>
        <TD WIDTH="5%" VALIGN="CENTER" >
            <A HREF="javascript:window.print();" TITLE='Click to Print wip flush'><IMG HEIGHT="60" WIDTH="60" SRC="<%=chipTracContext%>/jsp/includes/images/printer_icon_small.gif" BORDER="0"></A>
        </TD>
    </TR>
    <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
    <%
        int fabTotalQty = 0;
        int waferStoreTotalQty = 0;
        int fabOptionTotalQty = 0;
        int sortTotalQty = 0;
        int dieBankTotalQty = 0;
        int assemblyTotalQty = 0;
        int testTotalQty = 0;
        int ftTotalQty = 0;
        int fpoTotalQty = 0;
        int classStoreTotalQty = 0;
        int fgTotalQty = 0;
    %>
    <TR BGCOLOR="#DEE1E2" ALIGN = "CENTER" padding="0">
        <TD WIDTH="9%" NOWRAP style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Part Number</FONT></FONT></TD>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Fab</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Wafer Store</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Sort</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">DieBank</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Assembly</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Test</font></font></td>
        <%--<TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">FPO</font></font></td>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">Class Store</font></font></td>--%>
        <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLRTB"><FONT CLASS='NArialL'><FONT COLOR="#000000">FG</FONT></FONT></TD>
    </TR>
    <logic:iterate name="wipFlush" id="baseProduct" scope="session">
        <TR BGCOLOR="#F2DBDB" ALIGN = "RIGHT">
            <TD WIDTH="9%" NOWRAP ALIGN="LEFT" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="partNumber"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedFabQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedWaferStoreQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedSortQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedDieBankQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedAssemblyQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedTestQty"/></FONT></TD>
            <%--<TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedFpoQty"/></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedClassStoreQty"/></FONT></TD>--%>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLBR"><FONT CLASS='NArialL'><bean:write name="baseProduct" property="formattedFgQty"/></FONT></TD>
        </TR>
        <logic:iterate name="baseProduct" property="childMap" id="productMap">
             <bean:define name="productMap" property="value" id="product" type="com.scalar.chiptrack.operations.reports.WipFlush"/>
         <%
                fabTotalQty += product.getFabQty() ;
                waferStoreTotalQty += product.getWaferStoreQty();
                /*fabOptionTotalQty += product.getFabOptionQty();*/
                sortTotalQty += product.getSortQty();
                dieBankTotalQty += product.getDieBankQty();
                assemblyTotalQty += product.getAssemblyQty();
                testTotalQty += product.getTestQty();
                /*ftTotalQty += product.getFtQty();
                fpoTotalQty += product.getFpoQty();
                classStoreTotalQty += product.getClassStoreQty();*/
                fgTotalQty += product.getFgQty();
             %>
             <TR BGCOLOR="#CDCEE9" ALIGN = "RIGHT">
                <TD WIDTH="9%" NOWRAP ALIGN="LEFT" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="partNumber"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedFabQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedWaferStoreQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedSortQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedDieBankQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedAssemblyQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedTestQty"/></FONT></TD>
                <%--<TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedFpoQty"/></FONT></TD>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialS'><bean:write name="product" property="formattedClassStoreQty"/></FONT></TD>--%>
                <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLBR"><FONT CLASS='NArialS'><bean:write name="product" property="formattedFgQty"/></FONT></TD>
            </TR>
        </logic:iterate>
    </logic:iterate>
        <TR BGCOLOR="#DEE1E2" ALIGN="RIGHT">
            <TD WIDTH="9%" NOWRAP ALIGN="LEFT" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK">Grand Total</FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(fabTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(waferStoreTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(sortTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(dieBankTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(assemblyTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(testTotalQty)%></FONT></TD>
            <%--<TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(fpoTotalQty)%></FONT></TD>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLB"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(classStoreTotalQty)%></FONT></TD>--%>
            <TD WIDTH="9%" style="border-width:1px;" CLASS="tdThinBorderLBR"><FONT CLASS='NArialL' STYLE="COLOR:BLACK"><%=StringUtils.getUSNumberFormat(fgTotalQty)%></FONT></TD>
        </TR>
    </TABLE>
</TABLE>
</BODY>
</logic:present>
<logic:notPresent  name="wipFlush" scope="session">
<BODY bgcolor='ffffff' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' >
    <TABLE cellpadding='0' cellspacing='0' bgcolor='FDF5E6' border="0" width="100%"  height="100%" align=center>
        <TR>
            <TD>
                <TABLE align="center" border="0" width="40%" bgcolor="#FDF5E6">
                    <TR><TD>&nbsp;</TD></TR>
                    <TR><TD align="center" ><font class="NArialL" ><font color="red"><b>Session has been time out , Please close this window and login again.</b></font></font></TD></TR>
                    <TR><TD>&nbsp;</TD></TR>
                    <TR><TD align="center" ><a href="javascript:window.close();"><font class='NArialL'>[Close this window]</font></a></TD></TR>
                </TABLE>
            </TD>
       </TR>
       <TR><TD>&nbsp;</TD></TR>
    </TABLE>
</BODY>
</logic:notPresent>

</html:html>
